{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "32ea9dae",
   "metadata": {},
   "source": [
    "------\n",
    "* 2022-9-13 week 04\n",
    "* python课堂笔记\n",
    "* 记录人:梁颖\n",
    "------"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "e8361b47",
   "metadata": {},
   "source": [
    "## 上周回顾 ( range( ) ) range: 范围"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "c749027a",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "range(0, 5)"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "range(5)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "7adbc57d",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0\n",
      "1\n",
      "2\n",
      "3\n",
      "4\n"
     ]
    }
   ],
   "source": [
    "# for + range 决定循环的次数\n",
    "for i in range(5):\n",
    "    print(i)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "a70c8222",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "range(1, 5)"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "range(1,5)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "db6e49ce",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "1\n",
      "2\n",
      "3\n",
      "4\n"
     ]
    }
   ],
   "source": [
    "for i in range(1,5):\n",
    "    print(i)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "c2545c6f",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "range(1, 10, 3)"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "range(1,10,3)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "2e1c6e69",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "1\n",
      "4\n",
      "7\n"
     ]
    }
   ],
   "source": [
    "for i in range(1,10,3):\n",
    "    print(i)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "3407a2db",
   "metadata": {},
   "outputs": [],
   "source": [
    "# start? stop? step?"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "80f60a81",
   "metadata": {},
   "source": [
    "# 本周内容\n",
    "\n",
    "* type():检查类型\n",
    "\n",
    "> 1. 数值\n",
    ">> 1. int(整数）\n",
    ">> 2. float（浮点数）\n",
    ">> 3. complex（虚数，复数）\n",
    "\n",
    "> 2. 字符串"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "e06d6f32",
   "metadata": {},
   "source": [
    "## 1. 数值"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "a59ae203",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "9 <class 'int'>\n"
     ]
    }
   ],
   "source": [
    "## Number(数值)\n",
    "## int\n",
    "\n",
    "a = 9\n",
    "print(a,type(a))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "d0e7074a",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "11.5 <class 'float'>\n"
     ]
    }
   ],
   "source": [
    "## float\n",
    "\n",
    "b = 11.5\n",
    "print(b,type(b))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "id": "63fc0145",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(5+3j) <class 'complex'>\n"
     ]
    }
   ],
   "source": [
    "## complex(虚数，复数)\n",
    "c = 5 + 3j\n",
    "print(c,type(c))"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "9f5f94a8",
   "metadata": {},
   "source": [
    "## 2. 字符串（string）\n",
    "\n",
    "> "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "f47e2665",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Alex <class 'str'>\n"
     ]
    }
   ],
   "source": [
    "name = \"Alex\"\n",
    "-print(name,type(name))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "id": "f78eca64",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "\"doesn't\""
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "\"doesn't\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "id": "c1ca9b5d",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'nfdsjkf\"fdsnjlk'"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "'nfdsjkf\"fdsnjlk'"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "id": "e02303bc",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "\"doesn't\""
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "\"doesn\\'t\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "id": "1c4454bc",
   "metadata": {},
   "outputs": [],
   "source": [
    "nfu_index_pages_html = \"\"\"\n",
    "\n",
    "<head>\n",
    "\t<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">\n",
    "\n",
    "<script type=\"text/javascript\"> \n",
    "\tvar browser={\n",
    "\t    versions:function(){\n",
    "\t        var u = navigator.userAgent, app = navigator.appVersion;\n",
    "\t        return {//移动终端浏览器版本信息\n",
    "\t            trident: u.indexOf('Trident') > -1, //IE内核\n",
    "\t            presto: u.indexOf('Presto') > -1, //opera内核\n",
    "\t            webKit: u.indexOf('AppleWebKit') > -1, //苹果、谷歌内核\n",
    "\t            gecko: u.indexOf('Gecko') > -1 && u.indexOf('KHTML') == -1, //火狐内核\n",
    "\t            mobile: !!u.match(/AppleWebKit.*Mobile.*/)||u.indexOf('iPad') > -1, //是否为移动终端\n",
    "\t            ios: !!u.match(/\\(i[^;]+;( U;)? CPU.+Mac OS X/), //ios终端\n",
    "\t            android: u.indexOf('Android') > -1 || u.indexOf('Linux') > -1, //android终端或者uc浏览器\n",
    "\t            iPhone: u.indexOf('iPhone') > -1, //是否为iPhone或者QQHD浏览器\n",
    "\t            iPad: u.indexOf('iPad') > -1, //是否iPad\n",
    "\t            webApp: u.indexOf('Safari') == -1 //是否web应该程序，没有头部与底部\n",
    "\t        };\n",
    "\t    }(),\n",
    "\t}\n",
    "\tif(browser.versions.android || browser.versions.iPhone){\n",
    "\t\tvar url = document.location.href ;\n",
    "\t\tvar ext = url.substr(url.lastIndexOf(\".\"),url.length) ;\n",
    "\t\tif(ext != null && (ext == '.htm' || ext == '.html')){\n",
    "\t\t\turl = url.substr(0,url.lastIndexOf(\".\")) ;\n",
    "\t\t\turl = url + \"_mobile\" + ext ;\n",
    "\t\t}else{\n",
    "\t\t\turl = url + \"index_mobile.htm\" ;\n",
    "\t\t}\n",
    "\t\tdocument.location = url ;\n",
    "\t}\n",
    "</script>\n",
    " </head>\n",
    "\n",
    "\"\"\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "id": "a2838314",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "\n",
      "<head>\n",
      "\t<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">\n",
      "\n",
      "<script type=\"text/javascript\"> \n",
      "\tvar browser={\n",
      "\t    versions:function(){\n",
      "\t        var u = navigator.userAgent, app = navigator.appVersion;\n",
      "\t        return {//移动终端浏览器版本信息\n",
      "\t            trident: u.indexOf('Trident') > -1, //IE内核\n",
      "\t            presto: u.indexOf('Presto') > -1, //opera内核\n",
      "\t            webKit: u.indexOf('AppleWebKit') > -1, //苹果、谷歌内核\n",
      "\t            gecko: u.indexOf('Gecko') > -1 && u.indexOf('KHTML') == -1, //火狐内核\n",
      "\t            mobile: !!u.match(/AppleWebKit.*Mobile.*/)||u.indexOf('iPad') > -1, //是否为移动终端\n",
      "\t            ios: !!u.match(/\\(i[^;]+;( U;)? CPU.+Mac OS X/), //ios终端\n",
      "\t            android: u.indexOf('Android') > -1 || u.indexOf('Linux') > -1, //android终端或者uc浏览器\n",
      "\t            iPhone: u.indexOf('iPhone') > -1, //是否为iPhone或者QQHD浏览器\n",
      "\t            iPad: u.indexOf('iPad') > -1, //是否iPad\n",
      "\t            webApp: u.indexOf('Safari') == -1 //是否web应该程序，没有头部与底部\n",
      "\t        };\n",
      "\t    }(),\n",
      "\t}\n",
      "\tif(browser.versions.android || browser.versions.iPhone){\n",
      "\t\tvar url = document.location.href ;\n",
      "\t\tvar ext = url.substr(url.lastIndexOf(\".\"),url.length) ;\n",
      "\t\tif(ext != null && (ext == '.htm' || ext == '.html')){\n",
      "\t\t\turl = url.substr(0,url.lastIndexOf(\".\")) ;\n",
      "\t\t\turl = url + \"_mobile\" + ext ;\n",
      "\t\t}else{\n",
      "\t\t\turl = url + \"index_mobile.htm\" ;\n",
      "\t\t}\n",
      "\t\tdocument.location = url ;\n",
      "\t}\n",
      "</script>\n",
      " </head>\n",
      "\n",
      "\n"
     ]
    }
   ],
   "source": [
    "print(nfu_index_pages_html)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "3cf9a50e",
   "metadata": {},
   "source": [
    "### [2.2 关于字符串的方法及函数](https://docs.python.org/3/tutorial/introduction.html#numbers)\n",
    "\n",
    "> 1.Single quotes:'allow embedded\"double\"quotes'\n",
    "> 2.Double quotes:\"allow embedded\n",
    "> 3.Triple quotes:'''Three single quotes''' \"\"\"Three double quotes\"\"\"\n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "id": "0e2980c9",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "广州南方学院坐落于广州市从化温泉镇\n"
     ]
    }
   ],
   "source": [
    "# 关于有序性\n",
    "title = \"广州南方学院坐落于广州市从化温泉镇\"\n",
    "print(title)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "id": "3511542d",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'广'"
      ]
     },
     "execution_count": 20,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "title[0] # 取单一值"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "id": "97e478ed",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'州'"
      ]
     },
     "execution_count": 21,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "title[1] # 取单一值"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "id": "2031e7b1",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "17"
      ]
     },
     "execution_count": 22,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "len(title) # 检查文本的总长度"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "id": "2c1e3a63",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'镇'"
      ]
     },
     "execution_count": 23,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "title[-1]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "id": "4c86431e",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'广州南方学院'"
      ]
     },
     "execution_count": 24,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "title[0:6] # 取一定范围的值，这种方法我们称为\"切片\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "id": "b2a59f82",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'广州南方学院'"
      ]
     },
     "execution_count": 25,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "title[:6]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "id": "69478e3a",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "广\n",
      "州\n",
      "南\n",
      "方\n",
      "学\n",
      "院\n",
      "坐\n",
      "落\n",
      "于\n",
      "广\n",
      "州\n",
      "市\n",
      "从\n",
      "化\n",
      "温\n",
      "泉\n",
      "镇\n"
     ]
    }
   ],
   "source": [
    "## 利用for循环 遍历文本信息\n",
    "for i in title:\n",
    "    print(i)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "id": "7f2ca5f7",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0 广\n",
      "1 州\n",
      "2 南\n",
      "3 方\n",
      "4 学\n",
      "5 院\n",
      "6 坐\n",
      "7 落\n",
      "8 于\n",
      "9 广\n",
      "10 州\n",
      "11 市\n",
      "12 从\n",
      "13 化\n",
      "14 温\n",
      "15 泉\n",
      "16 镇\n"
     ]
    }
   ],
   "source": [
    "## enumerate 枚举，既可以获取到内容（item），又可以获取到索引值（index）。\n",
    "for i,j in enumerate(title):\n",
    "    print(i,j)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 34,
   "id": "4cc75f9a",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "文本中有广州\n",
      "文本中有广州\n"
     ]
    }
   ],
   "source": [
    "# 思考，如何判断一段文本中是否存在“广州”，例如文本 title 中的内容\n",
    "for i,j in enumerate(title):\n",
    "    if j == \"广\":\n",
    "        if title[i+1] == \"州\":\n",
    "            print(\"文本中有广州\")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "ea7cc01f",
   "metadata": {},
   "source": [
    "* Page59    in 检查成员对象"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 36,
   "id": "2eda11d3",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "True"
      ]
     },
     "execution_count": 36,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "## Page59    in 检查成员对象\n",
    "\"广州\" in title"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "087dbb7d",
   "metadata": {},
   "source": [
    "* 字符串的拼接"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 38,
   "id": "1008c771",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "你好,Alex\n"
     ]
    }
   ],
   "source": [
    "print(\"你好\"+\",\"+\"Alex\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 41,
   "id": "174b4a6e",
   "metadata": {},
   "outputs": [
    {
     "ename": "TypeError",
     "evalue": "can only concatenate str (not \"int\") to str",
     "output_type": "error",
     "traceback": [
      "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[0;31mTypeError\u001b[0m                                 Traceback (most recent call last)",
      "Input \u001b[0;32mIn [41]\u001b[0m, in \u001b[0;36m<cell line: 2>\u001b[0;34m()\u001b[0m\n\u001b[1;32m      1\u001b[0m \u001b[38;5;66;03m# 字符串不可以和数字进行连接\u001b[39;00m\n\u001b[0;32m----> 2\u001b[0m \u001b[38;5;28mprint\u001b[39m(\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43m你好\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;241;43m+\u001b[39;49m\u001b[43m \u001b[49m\u001b[38;5;241;43m1\u001b[39;49m \u001b[38;5;241m+\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mAlex\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n",
      "\u001b[0;31mTypeError\u001b[0m: can only concatenate str (not \"int\") to str"
     ]
    }
   ],
   "source": [
    "# 字符串不可以和数字进行连接\n",
    "print(\"你好\"+ 1 +\"Alex\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 39,
   "id": "52b119e9",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "1 <class 'int'>\n",
      "1 <class 'str'>\n"
     ]
    }
   ],
   "source": [
    "print(1,type(1))\n",
    "print(\"1\",type(\"1\"))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 40,
   "id": "629c5b64",
   "metadata": {},
   "outputs": [
    {
     "ename": "TypeError",
     "evalue": "unsupported operand type(s) for /: 'str' and 'str'",
     "output_type": "error",
     "traceback": [
      "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[0;31mTypeError\u001b[0m                                 Traceback (most recent call last)",
      "Input \u001b[0;32mIn [40]\u001b[0m, in \u001b[0;36m<cell line: 2>\u001b[0;34m()\u001b[0m\n\u001b[1;32m      1\u001b[0m \u001b[38;5;66;03m# 字符串不可以用来运算\u001b[39;00m\n\u001b[0;32m----> 2\u001b[0m \u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43m3\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m \u001b[49m\u001b[38;5;241;43m/\u001b[39;49m\u001b[43m \u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43m2\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\n",
      "\u001b[0;31mTypeError\u001b[0m: unsupported operand type(s) for /: 'str' and 'str'"
     ]
    }
   ],
   "source": [
    "# 字符串不可以用来运算\n",
    "\"3\" / \"2\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 43,
   "id": "3d052213",
   "metadata": {},
   "outputs": [],
   "source": [
    "# 由于没有分清楚字符串和熟知的概念导致的“笑话”\n",
    "width = \"16\"\n",
    "height = 9"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 44,
   "id": "544e5d3d",
   "metadata": {},
   "outputs": [],
   "source": [
    "面积 = width * height"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 50,
   "id": "dfae1fa6",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'161616161616161616'"
      ]
     },
     "execution_count": 50,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "面积"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "26056f71",
   "metadata": {},
   "source": [
    "* 字符串的方法\n",
    "> 1. str.capitalize():可以将首字母转成大写\n",
    "> 2. str.count():数量？\n",
    "> 3. str.split():"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 52,
   "id": "7188608c",
   "metadata": {},
   "outputs": [],
   "source": [
    "name = \"marry\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 53,
   "id": "4ab76fe4",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'Marry'"
      ]
     },
     "execution_count": 53,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "name.capitalize()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 54,
   "id": "ca53d4dc",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "2"
      ]
     },
     "execution_count": 54,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "name.count(\"r\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 56,
   "id": "c75ea2bf",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'广州南方学院坐落于广州市从化温泉镇'"
      ]
     },
     "execution_count": 56,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "title"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 55,
   "id": "89bbed4e",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "2"
      ]
     },
     "execution_count": 55,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "title.count(\"广州\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 57,
   "id": "99021cbf",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0"
      ]
     },
     "execution_count": 57,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "title.count(\"新媒体\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 58,
   "id": "e3582beb",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['广州南方学院', '广州市从化温泉镇']"
      ]
     },
     "execution_count": 58,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "title.split(\"坐落于\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 61,
   "id": "f7d226d0",
   "metadata": {},
   "outputs": [],
   "source": [
    "text = \"\"\"\n",
    "\n",
    "1.也称为整数除法。结果值是一个整数，尽管结果的类型不一定是 int。结果总是向负无穷大四舍五入：1//2is 0、(-1)//2is -1、1//(-2)is-1和(-1)//(-2)is 0。\n",
    "\n",
    "2.不适用于复数。abs()而是在适当的情况下转换为浮点数。\n",
    "\n",
    "3.从浮点到整数的转换可能会像在 C 中一样舍入或截断；见函数math.floor()和math.ceil()定义明确的转换。\n",
    "\n",
    "4.float 还接受字符串“nan”和“inf”，带有可选前缀“+”或“-”表示非数字 (NaN) 和正或负无穷大。\n",
    "\n",
    "5.Python 定义和to be ，这在编程语言中很常见。pow(0, 0)0 ** 01\n",
    "\n",
    "6.0接受的数字文字包括数字9或任何 Unicode 等价物（带有Nd属性的代码点）。\n",
    "\n",
    "\"\"\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 62,
   "id": "2aadd2a3",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['\\n\\n1.也称为整数除法',\n",
       " '结果值是一个整数，尽管结果的类型不一定是 int',\n",
       " '结果总是向负无穷大四舍五入：1//2is 0、(-1)//2is -1、1//(-2)is-1和(-1)//(-2)is 0',\n",
       " '\\n\\n2.不适用于复数',\n",
       " 'abs()而是在适当的情况下转换为浮点数',\n",
       " '\\n\\n3.从浮点到整数的转换可能会像在 C 中一样舍入或截断；见函数math.floor()和math.ceil()定义明确的转换',\n",
       " '\\n\\n4.float 还接受字符串“nan”和“inf”，带有可选前缀“+”或“-”表示非数字 (NaN) 和正或负无穷大',\n",
       " '\\n\\n5.Python 定义和to be ，这在编程语言中很常见',\n",
       " 'pow(0, 0)0 ** 01\\n\\n6.0接受的数字文字包括数字9或任何 Unicode 等价物（带有Nd属性的代码点）',\n",
       " '\\n\\n']"
      ]
     },
     "execution_count": 62,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "## 可以搜索停止词字典，进行文本拆分，然后进一步做分析\n",
    "text.split(\"。\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "04027a18",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.12"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
